<?php

namespace app\adminbackstage\controller;

use app\adminbackstage\service\OrderService;
use app\BaseController;
use think\facade\Request;

class Order extends BaseController
{
    /***
     * 订单列表
    */
    public function index()
    {
        if (Request::isPost()) {
            $page = Request::param("page",1);
            $num = Request::param("num",10);
            $post_num = Request::param("post_num","");
            $m_phone = Request::param("m_phone");
            $state = Request::param("state");//状态 1已录入 2已到网点  4已送达 6已结算
            $start_time = Request::param("start_time");
            $end_time = Request::param("end_time");
            $res = OrderService::orderListSerivce($page,$num,$post_num,$m_phone,$state,$start_time,$end_time);
            return $res;
        }
    }

    /***
     * 订单详情
    */
    public function orderDetail(){
        if (Request::isPost()) {
            $oId = Request::param("id");
            $res = OrderService::orderDetailedService($oId);
            return $res;
        }
    }

    public function orderEdit(){
        if (Request::isPost()) {
            $oId = Request::param("id");
            $state = Request::param("state");//状态 1已录入 2已到网点  4已送达 6已结算
            $res = OrderService::orderEditService($oId,$state);
            return $res;
        }
    }

    /***
     * 订单状态批量变更
    */
    public function orderBatchEdit(){
        if (Request::isPost()) {
            $a_uid = Request::param("a_uid");
            $oIds = Request::param("ids");
            $state = Request::param("state");//状态 1已录入 2已到网点  4已送达 6已结算
            $res = OrderService::orderBatchEditService($a_uid,$oIds,$state);
            return $res;
        }
    }
}